﻿
namespace cogency.representation
{
    public static class RDeclare
    {
        public static RDeclaration ClassDecl(string name, string comment, RDeclarationScope scope, params RDeclaration[] values)
        {
            return new RDeclaration(name, comment, RDeclarationType.ClassDeclaration, scope, items: values);
        }

        public static RDeclaration ClassRef(string referencedName, string variableName, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(variableName, comment, RDeclarationType.ClassReference, scope, referencedName: referencedName);
        }

        public static RDeclaration InterfaceDecl(string name, string comment, RDeclarationScope scope, params RDeclaration[] values)
        {
            return new RDeclaration(name, comment, RDeclarationType.InterfaceDeclaration, scope, items: values);
        }

        public static RDeclaration InterfaceRef(string referencedName, string variableName, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(variableName, comment, RDeclarationType.InterfaceReference, scope, referencedName: referencedName);
        }

        public static RDeclaration EnumDecl(string name, string comment, RDeclarationScope scope, params RDeclaration[] values)
        {
            return new RDeclaration(name, comment, RDeclarationType.EnumDeclaration, scope, items: values);
        }

        public static RDeclaration EnumRef(string referencedName, string variableName, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(variableName, comment, RDeclarationType.EnumReference, scope, referencedName: referencedName);
        }

        public static RDeclaration EnumValue(string name, string comment, string value = null)
        {
            return new RDeclaration(name, comment, RDeclarationType.EnumValueDeclaration, referencedName: value);
        }

        public static RDeclaration BuiltinInt32(string name, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(name, comment, RDeclarationType.BuiltinTypeReference, scope, RBuiltinType.Int32);
        }

        public static RDeclaration BuiltinInt64(string name, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(name, comment, RDeclarationType.BuiltinTypeReference, scope, RBuiltinType.Int64);
        }

        public static RDeclaration BuiltinBool(string name, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(name, comment, RDeclarationType.BuiltinTypeReference, scope, RBuiltinType.Boolean);
        }

        public static RDeclaration BuiltinString(string name, string comment, RDeclarationScope scope = RDeclarationScope.Ignored)
        {
            return new RDeclaration(name, comment, RDeclarationType.BuiltinTypeReference, scope, RBuiltinType.String);
        }

        public static RDeclaration Method(string name, string comment, RDeclarationScope scope, RDeclaration returnType, params RDeclaration[] values)
        {
            return new RDeclaration(name, comment, RDeclarationType.MethodDeclaration, scope, returnType: returnType, items: values); 
        }

    }
}
